# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gcr
pkgver=3.41.2
pkgrel=1
pkgdesc="library for bits of crypto UI and parsing"
url="https://wiki.gnome.org/Projects/CryptoGlue"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	glib-dev
	gobject-introspection-dev
	gtk-doc
	gtk+3.0-dev
	libgcrypt-dev
	libsecret-dev
	libxslt
	meson
	openssh-client
	p11-kit-dev
	vala
	"
checkdepends="
	bash
	gpg
	gpg-agent
	dbus-x11
	xvfb-run
	"
subpackages="
	$pkgname-dev
	$pkgname-lang
	$pkgname-base
	"
source="https://download.gnome.org/sources/gcr/${pkgver%.*}/gcr-$pkgver.tar.xz
	fix-64-bit-time_t-32-bit.patch
	"
# test failure in gcr:gcr-base / gnupg-collection
# https://gitlab.gnome.org/GNOME/gcr/-/issues/114
options="!check"

build() {
	# getpass
	CFLAGS="$CFLAGS -D_BSD_SOURCE" \
	abuild-meson \
		-Db_lto=true \
		-Dgtk_doc=false \
		-Dgpg_path=/usr/bin/gpg2 \
		-Dsystemd=disabled \
		-Dssh_agent=false \
		output
	meson compile -C output
}

check() {
	xvfb-run meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

base() {
	pkgdesc="$pkgdesc (base libraries)"
	depends=""

	amove usr/lib
}

sha512sums="
056c6c6a3910dae6997cef34fc95d22510ddea37be0ccc329996575a95e20582fa428bd491389aa77f8b6ffbd8674a2b3ba444cb83bdf3a2be5fd7aed276606d  gcr-3.41.2.tar.xz
579b229d6f310ed035974a92a65804deae7b047cf6109e259844ecdc75df32653a2c9f9dcddba9092da335f44d07d5d82056ae0cf5775057bdb9be5b52e29bcc  fix-64-bit-time_t-32-bit.patch
"
